import { BasePlugin } from "./BasePlugin";
import { ShellUtil } from "../util/ShellUtil";
import { ConfigUtil } from "../util/ConfigUtil";

export class PullServerManifest extends BasePlugin {
    getName(): string {
        return "拉服务器manifest";
    }    
    getDesc(): string {
        return "拉服务器manifest PullServerManifest 平台名";
    }
    do(args: string[], cb:()=>void): void {
        let sshServer = ConfigUtil.PlatCfg[args[0]].sshServer;
        ShellUtil.exec(`
        ssh -tt ${sshServer.username}@${sshServer.host} -p ${sshServer.port} 'sudo bash /data/autodeploy/publish_client_release_manifest.sh'
        `, (log:string)=>{
            console.log("log", log);
            console.log("pull server ok");
            cb();
        });
    }


}